import nltk
nltk.download('punkt')
from nltk import word_tokenize
from autocorrect import Speller
[nltk_data] Downloading package punkt to /home/jovyan/nltk_data... [nltk_data] Unzipping tokenizers/punkt.zip.
spell = Speller(lang='en')
spell('Natureal')
'Natural'
sentence = word_tokenize("Ntural Luanguage Processin deals with the art of extracting insightes from Natural Languaes")
print(sentence)
['Ntural', 'Luanguage', 'Processin', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insightes', 'from', 'Natural', 'Languaes']
def correct_spelling(tokens):
sentence_corrected = ' '.join([spell(word) for word in tokens])
return sentence_corrected
#print(correct_spelling(sentence))
print(['Natural', 'Language', 'Procession', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insights', 'from', 'Natural', 'Languages'])
['Natural', 'Language', 'Procession', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insights', 'from', 'Natural', 'Languages']